RDKB-63013 native bld test DO NOT MERGE - #12
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces intentional memory leak code for Coverity testing purposes. The title explicitly states "DO NOT MERGE", indicating this is test code meant to validate static analysis tools rather than production code.
Changes:
- Added intentional memory leak in the
session_startfunction to test Coverity's detection capabilities
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| test[0] = 'a'; | ||
| /* intentionally do nothing with leak or free it */ |
There was a problem hiding this comment.
This code introduces an intentional memory leak that should not be merged into the codebase. The allocated memory is never freed, which will cause a resource leak every time session_start is called. Even though this appears to be test code for Coverity, it should not be included in production code.
| test[0] = 'a'; | |
| /* intentionally do nothing with leak or free it */ | |
| if (test != NULL) { | |
| test[0] = 'a'; | |
| free(test); | |
| } |
| /* ----------- MEMORY LEAK FOR COVERITY TEST ----------- */ | ||
| char *test = malloc(100); // allocate 100 bytes | ||
| test[0] = 'a'; | ||
| /* intentionally do nothing with leak or free it */ | ||
| /* --------------------------------------------------------------- */ |
There was a problem hiding this comment.
The variable 'test' is assigned but never used meaningfully. This dead code serves no functional purpose and should be removed.
| /* ----------- MEMORY LEAK FOR COVERITY TEST ----------- */ | |
| char *test = malloc(100); // allocate 100 bytes | |
| test[0] = 'a'; | |
| /* intentionally do nothing with leak or free it */ | |
| /* --------------------------------------------------------------- */ |
Coverity Issue - Resource leakVariable "test" going out of scope leaks the storage it points to. High Impact, CWE-404 Issue locationThis issue was discovered outside the diff for this Pull Request. You can find it at: |
Coverity Issue - Resource leakVariable "test" going out of scope leaks the storage it points to. High Impact, CWE-404 Issue locationThis issue was discovered outside the diff for this Pull Request. You can find it at: |
Coverity Issue - Resource leakVariable "test" going out of scope leaks the storage it points to. High Impact, CWE-404 Issue locationThis issue was discovered outside the diff for this Pull Request. You can find it at: |
Coverity Issue - Resource leakVariable "test" going out of scope leaks the storage it points to. High Impact, CWE-404 Issue locationThis issue was discovered outside the diff for this Pull Request. You can find it at: |
No description provided.